﻿using System;
using System.Web;
using System.Web.Mvc;
using WebApplication1.ViewModels;


/// <summary>
/// 拦截器实现页脚统一
/// </summary>
namespace WebApplication1.Filters
{
    public class HeaderFooterFilter : ActionFilterAttribute
    {

        public override void OnActionExecuted(ActionExecutedContext filterContext)
        {
            ViewResult v = filterContext.Result as ViewResult;
            if (v != null)
            {
                BaseViewModel bvm = v.Model as BaseViewModel;
                if (v != null)
                {
                    bvm.UserName = HttpContext.Current.User.Identity.Name;
                    bvm.FooterData = new FooterViewModel();
                    bvm.FooterData.CompanyName = "StepByStepSchools";
                    bvm.FooterData.Year = DateTime.Now.Year.ToString();
                }

            }
        }
    }
}